package tst

import (
	"gitee.com/ymofen/gobase"
	"gitee.com/ymofen/panicsafe"
	"github.com/spf13/cobra"
	"sync"
	"time"
)

func init() {
	gobase.ArgFuncRegister("tst", gobase.ArgFuncOption{Catalog: "corbaRoot", Func: func(args string, tag interface{}) (val interface{}, err error) {
		var cmd = &cobra.Command{
			Use: "tst",
			Run: func(cmd *cobra.Command, args []string) {
				var wg sync.WaitGroup
				wg.Add(1)
				panicsafe.GoFunCatchException = false
				go gobase.GoRun(func() {
					defer wg.Done()
					panic("hello world")
				})
				time.Sleep(time.Second)

			},
		}
		return cmd, nil
	}})

}
